<template>
  <div class="container">
    <div>
      <logo />
      <h1 class="title">
        admin
      </h1>
      <h2 class="subtitle">
        this is init project
      </h2>
      <div class="links">
        <a
          href="https://nuxtjs.org/"
          target="_blank"
          class="button--green"
        >
          Documentation
        </a>
        <a
          href="https://github.com/nuxt/nuxt.js"
          target="_blank"
          class="button--grey"
        >
          GitHub222
        </a>
        <h1>总数：{{counter}}</h1>
        <h2>admin,user{{this.$store.state.admin.user.counter}}</h2>
        <Button @click="increment">+</Button>
        <Button type="error" v-auth="['admin2']" @click="log">log</Button>
        <Button type="error"  @click="log">log</Button>
      </div>
    </div>
  </div>
</template>

<script>
import { mapState } from 'vuex'
import Logo from '~/components/Logo.vue'

export default {
  fetch ({ store }) {
    store.commit('increment')
  },
  computed: mapState([
    'counter'
  ]),
  components: {
    Logo
  },methods: {
    increment () {
      this.$store.commit('increment')
    },
    log(){
      this.$log.push("这是一个错误！")
      this.$log.capsule('iView', 'Success', this);
      if (process.env.NODE_ENV === 'development'){
        alert(123)
      }
      alert(abc)
    }
  }
}
</script>